<template>
  <p>点击：{{ counter.count }} 次</p>
  <p>{{ counter.text }}</p>
  <button @click="increment">+</button>
  <button @click="decrement">-</button>
</template>

<script lang="ts">
export default {
  name: "App",
};
</script>

<script lang="ts" setup>
import { useCounterStore } from "./store/counter";

const counter = useCounterStore();

// const increment = () => {
//   counter.count++; // 更新一个数据
// };

// const increment = () => {
//   // 更新多个数据
//   counter.$patch({
//     count: counter.count + 1,
//   });
// };

const increment = () => {
  // 调用action函数
  counter.increment();
};

const decrement = () => {
  counter.decrement();
};
</script>

<style scoped></style>
